package dao.tables;

import java.util.ArrayList;

import dao.AbstractTable;

public class GROUPE extends AbstractTable {
	private long				id				= -1;
	private String				nom				= null;
	private ArrayList<OEUVRE>	repertoire		= new ArrayList<OEUVRE>();
	private ArrayList<OEUVRE>	copyright		= new ArrayList<OEUVRE>();
	private ArrayList<VaJouer>	representation	= null;

	public GROUPE() {}

	public GROUPE(long id, String nom, ArrayList<AbstractTable> repertoire,
		ArrayList<AbstractTable> copyright, ArrayList<VaJouer> representation) {
		this.setId(id);
		this.setNom(nom);
		this.setRepertoire(repertoire);
		this.setCopyright(copyright);
		this.setRepresentation(representation);
	}

	public GROUPE(long id, String nom) {
		this.setId(id);
		this.setNom(nom);
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getId() {
		return id;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getNom() {
		return nom;
	}

	@Override
	public String getValue() {
		return this.getNom();
	}

	public ArrayList<AbstractTable> getRepertoire() {
		ArrayList<AbstractTable> list = new ArrayList<AbstractTable>();
		for (AbstractTable val : this.repertoire)
			list.add(val);
		return list;
	}

	public void setRepertoire(ArrayList<AbstractTable> vector) {
		OEUVRE memb = null;
		repertoire = new ArrayList<OEUVRE>();
		for (AbstractTable val : vector) {
			memb = new OEUVRE();
			memb.setId(val.getId());
			memb.setTitre(val.getValue());
			repertoire.add(memb);
		}
	}

	public ArrayList<AbstractTable> getCopyright() {
		ArrayList<AbstractTable> list = new ArrayList<AbstractTable>();
		for (AbstractTable val : this.copyright)
			list.add(val);
		return list;
	}

	public void setCopyright(ArrayList<AbstractTable> vector) {
		OEUVRE memb = null;
		copyright = new ArrayList<OEUVRE>();
		for (AbstractTable val : vector) {
			memb = new OEUVRE();
			memb.setId(val.getId());
			memb.setTitre(val.getValue());
			copyright.add(memb);
			memb = null;
		}
	}

	public ArrayList<VaJouer> getRepresentation() {
		return representation;
	}

	public void setRepresentation(ArrayList<VaJouer> representation) {
		this.representation = representation;
	}
}
